<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsps/common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>查询客户信息</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href='<c:url value="/css/application.css"/>'>
	<link rel="stylesheet" type="text/css" href='<c:url value="/css/list.css"/>'>
	<link rel="stylesheet" type="text/css" href='<c:url value="/css/form.css"/>'>
	<script type="text/javascript" src="<c:url value="/js/common.js"/>"></script>

	<script type="text/javascript">
		function removeClient(clientNo,clientName){
			if(confirm("确认要删除客户["+clientName+"]的信息吗？")){
				location.href = '<c:url value="clientMgr?act=remove"/>&client_no='+clientNo;
			}
		}
		
		function updateClient(clientNo){
			location.href = '<c:url value="clientMgr?act=forUpdate"/>&client_no='+clientNo;
		}
		
		function presentClient(clientNo){
			location.href = '<c:url value="clientMgr?act=present"/>&client_no='+clientNo;
		}
		
		function createAccount(clientNo){
			location.href = '<c:url value="accountMgr?act=input"/>&client_no='+clientNo;
		}
		
		function doQuery(pageno){
			if(pageno<1 || pageno>${page.totalPageNum}){
	              alert("页号超出范围，有效范围：[1-${page.totalPageNum}]");
	              $('pageNo').select();
	              return;
			}
			var f=document.forms[0];
			f.action=f.action+"&pageno="+pageno;
			f.submit();
		}
	</script>
	<style type="text/css">
	body {
			background:url(pics/bg.jpg);
			-webkit-background-size: cover;
			-moz-background-size: cover;
			background-size: cover;
		}
</style>
  </head>
  
  <body> 
  
    <div id="wrapper">
		<div id="title">客户信息列表</div>
		<div id="qryarea">
			<form action=" <c:url value="/clientMgr?act=loadPagedClients"/>" method="post">
				<th>客户身份证号:</th> <input type="text" name="idcard_no" size="25" value="${idcard_no}">
				&nbsp;&nbsp;&nbsp;
				<input type="submit" value=" 查 询 " />
			</form>
		</div>
		
		<div>
			<table id="listtable" cellpadding="0" cellspacing="0">
				<tr>
					<th>客户编号</th>
					<th>客户身份证号</th>
					<th>客户名称</th>
					<th>创建时间</th>
					<th>操作员编号</th>
					<th>详细资料</th>
					<th>操作</th>
					<th>资金账户开户</th>
				</tr>
				<c:forEach var="client" items="${page.pageContent}">
					<tr>
						<td>${ client.clientNo}</td>
						<td>${ client.idcardNo}</td>
						<td>${ client.clientName}</td>
						<td>${ client.createDate}</td>
						<td>${ client.operCode}</td>
						<td>
							<button style="height=20px;width=70px"
									title="点击查询客户[${ client.clientName}]的详细信息"
									onclick="presentClient(${ client.clientNo});">更多信息
							</button>
						</td>
						<td>
							<button style="height=20px;width=50px"
								title="点击修改客户[${ client.clientName}]的信息"
								onclick="updateClient(${ client.clientNo});">修改
							</button> &nbsp;
							<button style="height=20px;width=50px"
								title="点击删除客户[${client.clientName}]的信息"
								onclick="removeClient(${ client.clientNo},'${ client.clientName}');">删除
							</button>
						</td>
						<td>
							<button style="height=20px;width=50px"
								title="点击为客户[${ client.clientName}]开设资金账户"
								onclick="createAccount(${ client.clientNo});">开户
							</button>
						</td>
					</tr>
				</c:forEach>
			</table>
			
			 <div id="pageinfo">
	                            共${page.totalRecNum}条, 当前显示${page.startIndex}-${page.endIndex}条, 第${page.pageNo}/${page.totalPageNum}页
	           |
	           <c:if test="${page.pageNo>1}">
	             <span class="linkspan" onclick="doQuery(1)">首页</span>&nbsp;
	           </c:if>
	           <c:if test="${page.prePage}">
	             <span class="linkspan" onclick="doQuery(${page.pageNo-1})">上一页</span>&nbsp;
	           </c:if>
	           <c:if test="${page.nextPage}">
	             <span class="linkspan" onclick="doQuery(${page.pageNo+1})">下一页</span>&nbsp;
	           </c:if>
	           <c:if test="${page.pageNo!=page.totalPageNum}">
	             <span class="linkspan" onclick="doQuery(${page.totalPageNum})">末页</span>&nbsp;
	           </c:if>
	           |
	                             到<input type="text" id="pageNo" size=4 style="text-align:right;" onkeypress="onlynumber();"/> 页
	           <button onclick="doQuery($('pageNo').value);"> 跳 转 </button>		           		           	           	              
	        </div>
		</div>
	</div>
  </body>
  
  <c:if test="${not empty check_err}">
		<script type="text/javascript">
			alert('${check_err}');
		</script>
 </c:if>
 
 <c:if test="${not empty success_msg}">
			<script type="text/javascript">
			alert('${success_msg}');
		</script>
 </c:if>
 
  <c:if test="${not empty del_err}">
			<script type="text/javascript">
			alert('${del_err}');
		</script>
 </c:if>
</html>
